package net.media.datafw.database.model;

import java.sql.ResultSet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Query {
	Logger logger = LoggerFactory.getLogger(getClass());

	protected final String query;
	protected final int resultsetType;
	protected final int resultsetConcurrency;
	private boolean getGeneratedKeys;

	public Query(String query, boolean isScrollSensitive, boolean isUpdateable) {
		this.query = query;
		this.resultsetType = isScrollSensitive ? ResultSet.TYPE_SCROLL_SENSITIVE
				: ResultSet.TYPE_FORWARD_ONLY;
		this.resultsetConcurrency = isUpdateable ? ResultSet.CONCUR_UPDATABLE
				: ResultSet.CONCUR_READ_ONLY;
	}

	public String getQuery() {
		return query;
	}

	public int getResultsetType() {
		return resultsetType;
	}

	public int getResultsetConcurrency() {
		return resultsetConcurrency;
	}

	public boolean isGetGeneratedKeys() {
		return getGeneratedKeys;
	}

	public void setGetGeneratedKeys(boolean getGeneratedKeys) {
		this.getGeneratedKeys = getGeneratedKeys;
	}
}
